<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title></title>
<link href="_css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="_script/jquery.js"></script>
<script src="_script/jquery.colorbox.js"></script>
<link type="text/css" media="screen" rel="stylesheet" href="_script/jquery.colorbox.css" />
<script type="text/javascript" src="_script/jquery.jgrowl.js"></script>
<link rel="stylesheet" type="text/css" href="_script/jquery.jgrowl.css" media="screen" />
<link rel="stylesheet" type="text/css" href="themes/blue/style.css" media="screen" />
<!--[if lt IE 7]><LINK href="_script/jquery.jgrowl.ie6.css" type=text/css rel=stylesheet><![endif]-->
<!-- / fim dos arquivos utilizados pelo jQuery jgrowl plugin -->
<script type="text/javascript"> 
$(function(){$(".user_x").colorbox({iframe:true,innerWidth:506, innerHeight:380});});
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}
$(function() {
	// 全选反选	
	$("#checkboxall").click(function(){
	    var checked_status = this.checked;   
		$("input[name='did[]']").each(function(){this.checked = checked_status;});
		});		
	// 选中的值	
	$("#sendAll").click(function(){
	
		var selectedStr = "";
		var $sendMail = $("input[name='did[]']");		
		$sendMail.each( function() {
			if ($(this).attr("checked")) {
				selectedStr += $(this).val() + "|";
			}
		});
		
		//alert(selectedStr);
		if (selectedStr == "") {
			$.jGrowl("至少选择一条数据!");
			return false;
		}
		
	if(confirm("您确认要删除？")){		
    $.post("<?php echo PHP_SELF?>", {action:"dels", delids: selectedStr}, 
		   function(data){

				  if(data==1){$.jGrowl("删除ID为["+selectedStr+"]的信息成功!", {beforeClose: function(e,m) {location.reload();}});}else{alert("更改出错");}
				  //alert(data);return false;				  
				  }); 
    }
//alert(selectedStr+$("#act")[0].value);		
	});		

		
});
function updatestate(state){
	if (state === "") {
		alert("缺少参数!");
		return false;
	}
	var ORDERSTATE=new Array("禁用","启用");
	var selectedStr = "";
	var sendMail = $("input[name='did[]']");		
	sendMail.each( function() {
		if ($(this).attr("checked")) {
			selectedStr += $(this).val() + "|";
		}
	});
	
	//alert(selectedStr);
	if (selectedStr == "") {
		$.jGrowl("至少选择一条数据!");
		//alert("至少选择一条数据");
		return false;
	}
	if(confirm("您确认要更改状态为"+ORDERSTATE[state]+"？")){
    $.post("<?php echo PHP_SELF?>", {action:"updatestate",state:state, ids: selectedStr}, 
		   function(data){
				  if(data==1){$.jGrowl("更改状态为["+ORDERSTATE[state]+"]成功!", {beforeClose: function(e,m) {location.reload();}});}else{alert("更改出错");}
				  //alert(data);return false;	  
				  }); 
    }
}
function updatedef(state){
	if (state === "") {
		alert("缺少参数!");
		return false;
	}
	var selectedStr = "";
	var sendMail = $("input[name='did[]']");		
	sendMail.each( function() {
		if ($(this).attr("checked")) {
			selectedStr += $(this).val() + "|";
		}
	});
	
	//alert(selectedStr);
	if (selectedStr == "") {
		$.jGrowl("至少选择一条数据!");
		//alert("至少选择一条数据");
		return false;
	}
	if(confirm("您确认要更改状态为默认？")){
    $.post("<?php echo PHP_SELF?>", {action:"updatedef",state:state, ids: selectedStr}, 
		   function(data){
				  if(data==1){$.jGrowl("更改状态为默认成功!", {beforeClose: function(e,m) {location.reload();}});}else{alert("更改出错");}
				  //alert(data);return false;	  
				  }); 
	}
}
</script>

<SCRIPT type=text/javascript>
function tools(){
var box_h="1";	
var top=$(document).scrollTop();
$("#topv")[0].value=top;
if(($.browser.msie==true)&&($.browser.version==6.0)){
if(top>box_h)$("#box_tools").css({position:"absolute",top:top-box_h});
}else{
if(top>box_h)$("#box_tools").css({position:"fixed",top:"-"&top+"px"});
}
if(top<=box_h)$("#box_tools").css({position:"static",top:0});
}

$(function(){
window.onscroll=tools;
window.onresize=tools;
});
function colorclose(){
	 parent.$.fn.colorbox.close();
}

</SCRIPT>
</head>
<body>
<div id="box_tools" class="floor_t">
  <div class="toolbgline">
  <table width="100%" border="0" cellspacing="2" cellpadding="0">
      <tr>
        <td width="28"><a href="javascript:location.reload();"><img src="images/admin.gif" alt="刷新" width="28" height="20" /></a></td>
        <td>
		<input type="button" id="sendAll" onclick="" class="btn" name="Submit" value="删除选定" />
		  <a href="?action=add"  class="btn_a user_x " style="margin-left:5px">添加</a>

		 </td>
        <td width="20"><input class="input w200"  style="width:20px;margin-right:2px" name="topv" type="text" id="topv" value="" /></td>
        <td width="1"></td>
      </tr>
    </table>
  </div>
</div>
<div class="floor_c">  
  <div class="xn"></div>
  <div class="boxf">
    <div class="boxn">

<?php if($action=="edit"){?>
<form action="?action=edit" method="post" enctype="multipart/form-data">
<table width="99%" border="0" align="center"  cellpadding="3" cellspacing="1" class="table_style tablesorter" >
    <tr>
      <td width="15%" align="right" class="left_title_1">ID：</td>
      <td width="85%"><input name="eid" type="text" id="eid" value="<?php echo $value['eid']?>"  readonly="true"/></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">邮箱地址：</td>
      <td><input name="smtp_email" type="text" id="smtp_email" value="<?php echo $value['smtp_email']?>"/></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">账户名称：</td>
      <td><input name="smtp_account" type="text" id="smtp_account" value="<?php echo $value['smtp_account']?>"/></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right" class="left_title_2">smtp地址：</td>
      <td><input name="smtp_server" type="text" id="smtp_server" value="<?php echo $value['smtp_server']?>"   /></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">邮箱密码：</td>
      <td><input name="smtp_password" type="text" id="smtp_password" value="<?php echo $value['smtp_password']?>"  /></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">auth：</td>
      <td>	  
	  <input type="radio" name="smtp_auth" value="1" <?php if($value['smtp_auth']==1)echo 'checked="checked"'?>/> 正常
        <input name="smtp_auth" type="radio" value="0" <?php if($value['smtp_auth']==0)echo 'checked="checked"'?> /> 禁用
         </td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">SSl：</td>
      <td> <input type="radio" name="smtp_ssl" value="1" <?php if($value['smtp_ssl']==1)echo 'checked="checked"'?>/> 正常
        <input name="smtp_ssl" type="radio" value="0" <?php if($value['smtp_ssl']==0)echo 'checked="checked"'?> /> 禁用
		 </td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">端口：</td>
      <td><input name="smtp_port" type="text" id="smtp_port" value="<?php echo $value['smtp_port']?>"></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">回复地址：</td>
      <td><input name="reply_address" type="text" id="reply_address" value="<?php echo $value['reply_address']?>"></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">状态：</td>
      <td>
        <input type="radio" name="state" value="1" <?php if($value['state']==1)echo 'checked="checked"'?>/> 正常
        <input name="state" type="radio" value="0" <?php if($value['state']==0)echo 'checked="checked"'?> /> 禁用
		
		</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right" class="left_title_2">&nbsp;</td>
      <td><input type="submit" name="Submit" value="提交" />
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="reset" name="Submit2" value="重置" /></td>
    </tr>
  </table>

  </form>
  
  <?php }elseif($action=="add"){?>
 
 <form action="?action=add" method="post" enctype="multipart/form-data">
<input name="gid" type="hidden" id="gid" value="<?php echo $gid;?>" />
<table width="99%" border="0" align="center"  cellpadding="3" cellspacing="1" class="table_style tablesorter" >
    <tr>
      <td align="right" class="left_title_2">邮箱地址：</td>
      <td><input name="smtp_email" type="text" id="smtp_email" value=""/></td>
    </tr>
    <tr>
      <td width="15%" align="right" class="left_title_2">账户名称：</td>
      <td width="85%"><input name="smtp_account" type="text" id="smtp_account"/></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right" class="left_title_2">smtp地址：</td>
      <td><input name="smtp_server" type="text" id="smtp_server"  /></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">邮箱密码：</td>
      <td><input name="smtp_password" type="text" id="smtp_password"  /></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">auth：</td>
      <td><input type="radio" name="smtp_auth" value="1" checked="checked"/>
正常
  <input name="smtp_auth" type="radio" value="0"  />
禁用 </td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">SSl：</td>
      <td><input type="radio" name="smtp_ssl" value="1" />
正常
  <input name="smtp_ssl" type="radio" value="0"  checked="checked" />
禁用 </td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">端口：</td>
      <td><input name="smtp_port" type="text" id="smtp_port"></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">回复地址：</td>
      <td><input name="reply_address" type="text" id="reply_address"></td>
    </tr>
    <tr>
      <td align="right" class="left_title_2">状态：</td>
      <td><input type="radio" name="state" value="1"  checked="checked"/>
正常
  <input name="state" type="radio" value="0"  />
禁用 </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right" class="left_title_2">&nbsp;</td>
      <td><input type="submit" name="Submitadd" value="提交" />
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="reset" name="Submit2" value="重置" /></td>
    </tr>
  </table>

  </form> 

  <?php }elseif(empty($action)){?>
<form method="post" action="?action=dels" name="grouplist" id="grouplist">
  <table width="100%" align="center"  border="0" cellpadding="3" cellspacing="1" class="table_style tablesorter" >
  <thead>
    <tr>
      <th width="2%"><label>
        <input type="checkbox" id=checkboxall name="chkall" value='ON' />
      </label></th>
      <th width="5%">ID</th>
      <th width="15%">账户名称</th>
      <th width="15%">smtp地址</th>
      <th width="12%">邮箱密码</th>
      <th width="13%">auth</th>
      <th width="7%">SSl</th>
      <th width="7%">端口</th>
      <th width="12%">状态</th>
      <th width="12%">操作</th>
    </tr>
</thead>
<tbody>
	<?php if(is_array($dataarray)){foreach($dataarray as $value){?>
    <tr class="odd_row">
      <td align="center"><input type="checkbox" name="did[]" value="<?php echo $value['eid']?>"/></td>
      <td><?php echo $value['eid']?></td>
      <td><?php echo $value['smtp_account']?></td>
      <td><?php echo $value['smtp_server']?></td>
      <td><?php echo $value['smtp_password']?></td>
      <td><?php echo $value['smtp_auth']?>&nbsp;&nbsp;</td>
      <td><?php echo $value['smtp_ssl']?></td>
      <td><?php echo $value['smtp_port']?></td>
      <td><?php if($value['state']==1)echo "√";else echo "×";?>&nbsp;</td>
      <td>
<a href="smtp_list.php?action=edit&amp;eid=<?php echo $value['eid']?>">编辑账户 </a>|<a href="javascript:if(confirm('确实要删除吗?'))location='smtp_list.php?action=del&eid=<?php echo $value['eid']?>'"> 删除</a></td>
    </tr>
</tbody>
	<?php }}else{?>
	<tr><td colspan=10>暂无数据..............</td></tr>
	<?php };?>
  </table>	

<div style="width:100%;margin:0px auto;">
    <?php echo multi($total,$pagesize,$page,"");?>
</div>
  <?php };?>
    </div>
  </div>
  <div class="xn"></div>
  <div class="x1"></div>
</div>
<iframe src="about:blank" name="ActFrm" id="ActFrm" style="display:none"></iframe>
</body>
</html>